package org.pzy.java.base;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @Author: DRevelation
 * @Date: 2022/10/17 17:04
 */
public class OrderDemo {
    public static void main(String[] args) {
        String str = "";

        JSONArray array = JSON.parseArray(str);
        List<Vote> votes = new ArrayList<>();
        for (int i = 0; i < array.size(); i++) {
            JSONObject object = array.getJSONObject(i);
            Vote vote = JSON.parseObject(object.toJSONString(), Vote.class);
            votes.add(vote);
        }
        votes.sort(Comparator.comparing(Vote::getOptionVoteNum).reversed());
        String s = JSON.toJSONString(votes);
        System.out.println(s);
    }
}
